package com.jack.cms.common.constant.tips;

import com.alibaba.fastjson.JSON;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

/**
 * 返回给前台的提示（最终转化为json形式）
 *
 * @author JackYuan
 * @Date 2017年1月11日 下午11:58:00
 */
@ApiModel(value = "API结果")
public abstract class Tip<T> {

	@ApiModelProperty(name = "code", value = "状态码", dataType = "Integer", example = "200")
	protected int code = 200;
	@ApiModelProperty(name = "message", value = "消息", dataType = "String",example="操作成功")
	protected String message;
	@ApiModelProperty(name = "timestamp", value = "时间戳", dataType = "Long")
	protected long timestamp;
	@ApiModelProperty(name = "content", value = "响应数据", dataType = "Object")
	protected T content;
	@ApiModelProperty(name = "messageId", value = "请求序列号", dataType = "String")
	protected String messageId;

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public long getTimestamp() {
		return timestamp;
	}

	public void setTimestamp(long timestamp) {
		this.timestamp = timestamp;
	}

	public T getContent() {
		return content;
	}

	public void setContent(T content) {
		this.content = content;
	}

	public String getMessageId() {
		return messageId;
	}

	public void setMessageId(String messageId) {
		this.messageId = messageId;
	}

	@Override
	public String toString() {
		return JSON.toJSONString(this);
	}
}
